#include <bits/stdc++.h>
#include <string>
using namespace std;

int main()
{
    int n, m, minS = 999999999;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            m = n / (i * j);
            if (i * j * m == n)
            {
                minS = min(minS, 2 * (i * j + i * m + j * m));
            }
        }
    }
    cout << minS;
    return 0;
}